package com.guniao;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.context.ApplicationContext;
import org.springframework.core.env.Environment;

import java.net.InetAddress;
import java.net.UnknownHostException;

/**
 * 启动程序
 * 
 * @author guniao
 */
@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
public class GuNiaoApplication
{
    public static void main(String[] args)
    {
        // System.setProperty("spring.devtools.restart.enabled", "false");
        ApplicationContext context = SpringApplication.run(GuNiaoApplication.class, args);

        try {
            InetAddress ip = InetAddress.getLocalHost();
            String hostAddress = ip.getHostAddress();
            Environment env = context.getEnvironment();
            String port = env.getProperty("server.port");
            String prefix = env.getProperty("swagger.pathMapping");
            System.out.println("后端接口请求地址：http://" + hostAddress + ":" + port + prefix);
            System.out.println("swagger地址：http://" + hostAddress + ":" + port + "/doc.html");
            System.out.println("数据监控地址：http://" + hostAddress + ":" + port + "/druid/login.html");

            System.out.println("(♥◠‿◠)ﾉﾞ  项目启动成功   ლ(´ڡ`ლ)ﾞ  \n" +

                    "      /\\_____/\\            \n" +
                    "     /  o   o  \\           \n" +
                    "    ( ==  ^  == )          \n" +
                    "      )        (           \n" +
                    "    (           )          \n" +
                    "   ( (  )   (  ) )         \n" +
                    "  (__(__)___(__)__)         ");
        } catch (UnknownHostException e) {
            e.printStackTrace();
        }


    }
}
